package com.shushan.home.bean;

import com.android.net.bean.NetBaseBean;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: SatiscTimeBean
 * @Desciption: 今日时间奖励统计bean
 * @author: yichaohua
 * @date: 2018-07-20
 */
public class SatiscTimeBean extends NetBaseBean {

    public int id;
    public int practice_type;
    public int paper_id;
    public int child_id;
    public int score;
    public int play_time;
    public String create_time;
    public String name;

    private List<UseAppBean> useAppBeanList = new ArrayList<UseAppBean>();

    @Override
    public void initByJson(JSONObject jsonObject) throws JSONException {

        id = jsonObject.optInt("id",0);
        practice_type = jsonObject.optInt("practice_type",0);
        paper_id = jsonObject.optInt("paper_id",0);
        child_id = jsonObject.optInt("child_id",0);
        score = jsonObject.optInt("score",0);
        play_time = jsonObject.optInt("play_time",0);
        create_time = jsonObject.optString("create_time","");
        name = jsonObject.optString("name","");

        JSONArray jsonArray = jsonObject.optJSONArray("play");
        if(jsonArray != null){
            for (int i = 0;i < jsonArray.length();i++){
                JSONObject object = jsonArray.optJSONObject(i);
                UseAppBean useAppBean = new UseAppBean();
                useAppBean.initByJson(object);

                useAppBeanList.add(useAppBean);
            }
        }
    }

    public List<UseAppBean> getUseAppBeanList() {
        return useAppBeanList;
    }

    public void setUseAppBeanList(List<UseAppBean> useAppBeanList) {
        this.useAppBeanList = useAppBeanList;
    }
}
